<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    
    <div class="orange"></div>
    <div class="banana"></div>
    <div class="apple"></div>

    <script src="../d3.js"></script>
    <script>
      const array = ['apple','orange','banana'];

      d3.selectAll('div')
        .data(array,function(d,i,list){
          console.log(arguments);
          return d ? d : this.classList[0];
        })
        .text(d=>d)

    </script>
  </body>
</html>
